[n, k] = input('输入人数和退出圈子的编号，用空格隔开').split(' ')
correctInput = False

while not(correctInput):
    while not(n.isdigit()) or not(k.isdigit()):
        print('请输入正确格式\n')
        [n, k] = input('输入人数和退出圈子的编号，用空格隔开').split(' ')
    n = int(n)
    k = int(k)

    if n == 0 or k == 0:
        print('请输入两个正整数\n')
    else:
        correctInput = True

list = list(range(1, n + 1))
num = 1
index = 0

#每删除一次判断一次长度
#n代表当前list的长度
while n > 1:
    if index == n:
        index = 0
    while num != k:
        num += 1
        index += 1
        if index == n:
            index = 0
    print(list.pop(index), end = ' ')
    num = 1
    n -= 1